//
//  RZDetailViewController.m
//  Sports-Go
//
//  Created by rimi on 16/9/20.
//  Copyright © 2016年 YRL. All rights reserved.
//

#import "RZDetailViewController.h"

@interface RZDetailViewController ()
@property(nonatomic,strong)NSDictionary *dic;
@end

@implementation RZDetailViewController

- (instancetype)initWithDic:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        _dic = dic;
    }
    return self;
}
- (void)viewWillAppear:(BOOL)animated{
    self.tabBarController.tabBar.hidden = YES;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.title = @"知识详情";
    self.view.backgroundColor = [UIColor whiteColor];
    [self setUI];
}
- (void)setUI{
   
    UITextView *text = [[UITextView alloc]initWithFrame:CGRectMake(10, 64, screen_size.width-20, screen_size.height-64-5)];
    text.editable = NO;
    text.font = [UIFont systemFontOfSize:15];
    UIImageView *imageView = [[UIImageView alloc]init];
    [imageView sd_setImageWithURL:[NSURL URLWithString:_dic[@"headUrl"]]];
    NSTextAttachment *textAttachment = [[NSTextAttachment alloc] initWithData:nil ofType:nil] ;
    textAttachment.image = imageView.image;
    
    NSAttributedString *ss = [[NSAttributedString alloc]initWithString:_dic[@"titleIntro"] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]}];
    NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithAttributedString:ss];
    NSAttributedString *textAttachmentString = [NSAttributedString attributedStringWithAttachment:textAttachment];
    [string insertAttributedString:textAttachmentString atIndex:0];
    text.attributedText = string;
    [self.view addSubview:text];


}
- (void)viewWillDisappear:(BOOL)animated{
    self.tabBarController.tabBar.hidden = NO;
}

@end
